<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="./include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>同行者第三方用户登录</title>
    <%@include file="./include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/ui/index.css">
    <link rel="stylesheet" href="${ctx}/css/ui/partner_login.css">
    <link rel="stylesheet" href="${ctx}/css/common/layout.css">
    <style type="text/css">
        .width-120 {
            width: 120px !important;
        }

        .login-inner-box .inner-form {
            width: 950px !important;
        }

        .inner-logo {
            height: auto !important;
            margin-top: 70px;
            margin-bottom: 100px;
        }

        .form-label, #login_btn {
            font-size: 20px !important;
        }
    </style>
</head>
<body>
<!--头部-->
<div class="">
    <div class="banner-container">
        <div class="banner-bg-blur" style="background-image: url(${ctx}/image/login/bg_img.jpg)"></div>
        <img class="banner-bg" src="${ctx}/image/login/bg_img.jpg" alt="">
        <div class="login-inner-box">
            <div class="inner-logo">
                <img src="${ctx}/image/login/logo_img.jpg" style="">
            </div>
            <div class="inner-form">
                <form id="my_from" class="layui-form my-form" method="post">
                    <div class="layui-inline">
                        <label class="layui-form-label form-label width-120">访问编码:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="loginName" lay-verify="loginName" autocomplete="off"
                                   placeholder="请输入访问编码" class="layui-input form-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label form-label width-120">访问密码:</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password" lay-verify="password" autocomplete="off"
                                   placeholder="请输入访问密码" class="layui-input form-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ml30">
                            <button type="button" class="layui-btn layui-btn-danger login-btn" id="login_btn" lay-submit
                                    lay-filter="login-form">访问
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 合作伙伴 -->
<%@include file="./include/partner.jsp" %>

<!--底部-->
<%@include file="./include/footer.jsp" %>
<script>
    $(function () {
        layui.use(['form'], function () {
            var form = layui.form;
            form.verify({
                loginName: function (value) {
                    if (!util.isValid(value)) {
                        return "访问编码不能为空";
                    }
                },
                password: function (value) {
                    if (!util.isValid(value)) {
                        return "访问密码不能为空";
                    }
                }
            });

            // 登录
            form.on('submit(login-form)', function (data) {
                txz.ajaxRequest({
                    url: '${ctx}/user/login/doThirdLogin.do',
                    type: 'POST',
                    async: false, // 使用同步的方法
                    params: $('#my_from').serialize(),
                    callBack: function (res) {
                        if (res.success) {
                            location.href = res.description;
                        } else {
                            util.layerMsgError(res.description)
                            console.log(res.description);
                        }
                    }
                })
            });

            // 回车登录
            $("#my_from").keydown(function (e) {
                var e = e || event, keycode = e.which || e.keyCode;
                if (keycode == 13) {
                    $("#login_btn").trigger('click');
                }
            });
        });
    });
</script>
</body>
</html>